<div class="content">
	<div class="n-row">&nbsp;</div>

	<style type="text/css">
	td {cursor: pointer;}
	.nrules-used{color: green}
	.nrules{color: thistle}
	</style>

	<table id="nrules-site" class="a-table a-table-striped">
		<thead>
		<tr>
				<th>应用分类</th>
		</tr>
		</thead>
		<tbody>
			<?php
			if(!empty($data['f_anrule'])){
				$f_nrule = empty($data['f_nrule'])?array():array_keys($data['f_nrule']);
				foreach($data['f_anrule'] as $key=>$val){
					$str = $data['scode'].'-'.$data['rule'].'-'.$key;
					if (in_array($key, $f_nrule)) {
						$str .= '-r';
			?>
					<tr><td class="nrules-used" vl="<?=$str?>"><?=$val?></td></tr>
			<?php
					}else{
						$str .= '-a';
			?>
					<tr><td class="nrules" vl="<?=$str?>"><?=$val?></td></tr>
			<?php
					}
				}
			}else{
			?>
		    <tr>
				<td>
				暂无数据
				</td>
		    </tr>
			<?php
			}
			?>
		</tbody>
		<tfoot>
		  <tr><th>&nbsp;</th></tr>
		</tfoot>
	</table>
<!-- 	<a href="<?=n_url('libmg','index')?>" target="_blank" style="float:right;">关联</a> -->
	<script>
	$(document).ready(function(){
		$('#nrules-site tbody tr td').click(function(){
			var q = $(this).attr('vl');
			var obj = $(this);
			var arr = q.split('-');

			$.post('/nsite/nruleUsedSave.html',{'qurey':q},function(data){
					if (data.state == false) return false;
					if (arr[3] == 'r') {
						obj.removeClass('nrules-used').addClass('nrules');
						var nq = q.replace('-r','-a');
						obj.attr('vl',nq);
					}else{
						obj.removeClass('nrules').addClass('nrules-used');
						var nq = q.replace('-a','-r');
						obj.attr('vl',nq);
					}
			});

		});
	});

	</script>
</div>